<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/common/head.jsp"%>
</head>
<body class="${cookie.bodyClass.value}">
	<div class="container body">
		<div class="main_container">
			<%@ include file="/WEB-INF/common/left.jsp"%>
			<%@ include file="/WEB-INF/common/top.jsp"%>
			<!-- page content -->
			<div class="right_col" role="main" id="main">
				<div class="x_panel">
					<div class="x_title">
						<h2>商品管理</h2>
						<div class="clearfix"></div>
					</div>
					<div class="x_content">
						<form role="form" id="searchForm">
							<div class="container">
								<div class="row">
									<div class="col-lg-3">
										<input class="form-control input-sm" placeholder="提现人昵称" name="map['nickName']"/>
									</div>
									<div class="col-lg-3">
										<select class="form-control input-sm"  name="map['status']" > 
											<option value="">状态</option>
											<option value="0">待审核</option>
											<option value="1">已打款</option>
										</select>
									</div>
									<div class="col-lg-3">
										<button type="button" class="btn btn-primary btn-sm" onclick="search();">搜索</button>
									</div>
								</div>
							</div>
						</form>
						<div class="table-responsive">
							<table id="withdrawalss" class="table table-bordered table-striped table-hover" 
							  cellspacing="0" width="100%">
								<thead>
									<tr class="mytableHead">
										<th class="myRowNumber"></th>
										<!-- <th>id</th> -->
										<th>提现人电话</th>
										<th>提现人昵称</th>
										<th>提现金额</th>
										<th>提现手续费</th>
										<th>实际打款金额</th>
										<th>状态</th>
										<th>提现银行</th>
										<th>银行所属支行</th>
										<th>银行预留姓名</th>
										<th>银行卡号</th>
										<th>提现申请时间</th>
										<th>操作</th>
									</tr>
								</thead>
							</table>
						</div>
					</div>
				</div>
			</div>
			<!-- /page content -->
			<%@ include file="/WEB-INF/common/foot.jsp"%>
		</div>
	</div>
	<%@ include file="/WEB-INF/common/script.jsp"%>
	<script>
	$(function(){
		var t = $("#withdrawalss").DataTable({
		    ajax: {
		        url: ctx+'admin/withdrawals/findWithdrawalss',
		        type: 'POST',
		        data: function(d){$.extend(d,serializeObject($("#searchForm")));}
		    },
		    columns: [
		              	{ "data":null,"render":rowNumberRender},
				       /*  { "data":'withdrawalsId'}, */
				        { "data":'cellphone'},
				        { "data":'nickName'},
				        { "data":'money'},
				        { "data":'brokerage'},
				        { "data":'payMoney'},
				        { "data":'status',"render":statusRender},
				        { "data":'bankName'},
				        { "data":'bankBranch'},
				        { "data":'reservedName'},
				        { "data":'bankCardNumber'},
				        { "data":'createDate'},
				        { "data":'id',"render":optRender}
		    ]
		    
		});
		$("#searchForm input").keydown(function(event){
			if(event.keyCode == 13){
				search();
			}
		});
		$("#searchForm select").change(search);
	});
	
	function optRender(data, type, row, meta){
		var but = '<a class="btn btn-info btn-xs" href="javascript:view('+meta.row+')"><i class="fa fa-pencil"></i>编辑</a>';
		return but;
	}
	function view(index,event){
		var row = $('#withdrawalss').DataTable().rows().data()[index];
		window.location = ctx+"admin/withdrawals/toWithdrawalsDetailPage?withdrawalsId="+row.withdrawalsId;
	}
	
	function rowNumberRender(data, type, row, meta) {
	    var setting = meta.settings;
	    var rowNumber = setting._iDisplayStart + (meta.row + 1);
		return rowNumber;
  	}
	function statusRender(data, type, row, meta){
		var status = row.status;
		if(Number(status)==0){
		    return '待审核';
		}else if(Number(status)==1){
            return '已打款';
		}
	}

	function search(){
		$('#withdrawalss').DataTable().ajax.reload(function(d){$.extend(d,serializeObject($("#searchForm")));}, true);
	}
	</script>
</body>
</html>